package com.gem.day03;

/**
 * 99乘法表
 */
public class ForDemo2 {
	public static void main(String[] args) {
		print99SingleFor();
	}

	/**
	 * 双层for循环
	 */
	public static void print99DoubleFor() {
		for (int i = 1; i <= 9; i++) {//行
			for (int j = 1; j <= i; j++) {//列
				System.out.print(j + "*" + i + "=" + i * j + "\t");
			}
			System.out.println();
		}
	}

	/**
	 * 单层for循环
	 */
	public static void print99SingleFor() {
		for (int i = 1, j = 1; j <= 9; i++) {
			System.out.print(i + "*" + j + "=" + i * j + "\t");
			if (i == j) {
				i = 0;
				j++;
				System.out.println();
			}
		}
	}
}
